let parse_lyric = lyric => {
  let lyricInfoArray = [];
  let lyricMsg = lyric.split("\n");

  lyricMsg.forEach(item => {
    let lyricInfo;
    let res = item.match(/\[(\d{2}):(\d{2})\.(\d{2,3})\]/i); //加上全局的g 而不是is就是拿到完整到拿不到分组
    let text = item.replace(/\[(\d{2}):(\d{2})\.(\d{2,3})\]/i, "");
    if (!res) return;

    let minTime = res[1] * 60 * 1000;
    let secTime = res[2] * 1000;
    let mileTime = res[3].length == 2 ? res[3] + "0" : res[3];
    let sumTime = minTime + secTime + mileTime;

    lyricInfo = { sumTime, text };
    lyricInfoArray.push(lyricInfo);
  });
  return lyricInfoArray;
};

module.exports = {
  parse_lyric,
};
